import { Persistent, BasicKeys } from '/@/utils/cache/persistent'
import { TOKEN_KEY } from '/@/enums/cacheEnum'

export function getAuthCache<T>(key: BasicKeys) {
  const fn = Persistent.getLocal
  return fn(key) as T
}
export function getToken(): string {
  return getAuthCache(TOKEN_KEY)
}
export function setAuthCache(key: BasicKeys, value: any) {
  const fn = Persistent.setLocal
  return fn(key, value, true)
}

export function clearAuthCache(immediate = true) {
  const fn = Persistent.clearLocal
  return fn(immediate)
}
